﻿<!--Copyright © Steffen Zeidler 2010-->
<Window x:Class="MarbleDiagramGenerator.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	    xmlns:PresentationOptions="http://schemas.microsoft.com/winfx/2006/xaml/presentation/options" 
        Title="Marble Diagram Generator" SizeToContent="WidthAndHeight" Loaded="Window_Loaded">
    <Window.Resources>
        <DrawingBrush x:Key="MyGridBrushResource" PresentationOptions:Freeze="True" Viewport="0,0,10,10" ViewportUnits="Absolute" TileMode="Tile">
            <DrawingBrush.Drawing>
                <DrawingGroup>
                    <DrawingGroup.Children>
                        <GeometryDrawing Geometry="M0,0 L1,0 1,0.1, 0,0.1Z M0,0 L0,1 0.1,1, 0.1,0Z" Brush="LightSkyBlue" />
                    </DrawingGroup.Children>
                </DrawingGroup>
            </DrawingBrush.Drawing>
        </DrawingBrush>
        <DrawingBrush x:Key="MyGridBrushResource2" PresentationOptions:Freeze="True" Viewport="0,0,100,100" ViewportUnits="Absolute" TileMode="Tile">
            <DrawingBrush.Drawing>
                <DrawingGroup>
                    <DrawingGroup.Children>
                        <GeometryDrawing Geometry="M0,0 L1,0 1,0.01, 0,0.01Z M0,0 L0,1 0.01,1, 0.01,0Z" Brush="Blue" />
                    </DrawingGroup.Children>
                </DrawingGroup>
            </DrawingBrush.Drawing>
        </DrawingBrush>
        <DataTemplate x:Key="Label1">
            <Canvas>
                <TextBlock Text="{Binding Path=Label}" ToolTip="{Binding Path=Text}" Canvas.Left="-80" Canvas.Bottom="{Binding Path=Y}" Width="75" Margin="0,-8" Foreground="{Binding Path=Brush}" TextAlignment="Right"/>
            </Canvas>
        </DataTemplate>
        <DataTemplate x:Key="Point1">
            <Canvas>
                <TextBlock Text="{Binding Path=Symbol}" ToolTip="{Binding Path=Text}" Canvas.Left="{Binding Path=X}" Canvas.Bottom="{Binding Path=Y}" Margin="0,-8" Foreground="{Binding Path=Brush}"/>
            </Canvas>
        </DataTemplate>
        <DataTemplate x:Key="Point2">
            <Canvas>
                <Ellipse ToolTip="{Binding Path=Text}" Width="8" Height="8" Canvas.Left="{Binding Path=X}" Canvas.Bottom="{Binding Path=Y}" Margin="-4" Fill="{Binding Path=Brush}" />
                <TextBlock Text="{Binding Path=Label}" Margin="8,0,0,-16" Foreground="{Binding Path=Brush}" Canvas.Left="{Binding Path=X}" Canvas.Bottom="0">
                    <TextBlock.RenderTransform>
                        <RotateTransform Angle="45"/>
                    </TextBlock.RenderTransform>
                </TextBlock>
           </Canvas>
        </DataTemplate>
    </Window.Resources>
    <ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="80" />
                <ColumnDefinition/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="100"/>
            </Grid.RowDefinitions>
            <Label Grid.ColumnSpan="2">Edit or Select Observable Expression:</Label>
            <ComboBox Grid.Column="0" Grid.Row="1" Grid.ColumnSpan="2" Name="Expression1" IsEditable="True" SelectedIndex="0"/>
            <Button Grid.Column="0" Grid.Row="2" Content=".Subscribe()" Click="buttonStart_Click" IsDefault="True" />
            <TextBlock Grid.Row="3" Grid.ColumnSpan="3" Name="Errors1" Visibility="Collapsed" TextWrapping="Wrap"/>
            <Border Name="Grid1" Grid.Column="1" Grid.Row="3" HorizontalAlignment="Left" BorderThickness="1" BorderBrush="Black" Background="Transparent">
                <Grid Background="{StaticResource MyGridBrushResource}">
                    <Grid Name="Diagram1" Height="200" Width="1000" Background="{StaticResource MyGridBrushResource2}">
                    </Grid>
                </Grid>
            </Border>
        </Grid>
    </ScrollViewer>
</Window>
